package com.congee02.thread;

/**
 * @author congee02
 * @date 1/31/2023 4:23 PM
 */
public class ExtendThreadTest {

    public static void main(String[] args) {
        new PrintThread("西门", 80).start();
    }
    
    private static class PrintThread extends Thread {

        private transient final int printTime;

        private String printString;

        public PrintThread(String printString, int printTime) {
            this.printString = printString;
            this.printTime = printTime;
        }

        @Override
        public void run() {
            try {
                for (int i = 0 ; i < printTime ; i ++ ) {
                    System.out.println("第" + i + "次: " + printString);
                    sleep(1000);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    
    
}
